{{Extend "layout"}}
{{Block "title"}}{{"修改个人资料"|T}}{{/Block}}
{{Block "breadcrumb"}}
{{Super}}
<li class="active">{{"修改个人资料"|T}}</li>
{{/Block}}
{{Block "main"}}

<div class="row">
    <div class="col-md-12">
        <div class="block-flat">
          <div class="header">							
            <h3>{{"修改个人资料"|T}}</h3>
          </div>
          <div class="content">
              <form class="form-horizontal group-border-dashed" parsley-validate novalidate method="POST" action="">
              <div class="form-group">
                <label class="col-sm-2 control-label">UID</label>
                <div class="col-sm-8">
                    <span class="form-control no-border">{{Stored.user.Id}}</span>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">{{"用户名"|T}}</label>
                <div class="col-sm-8">
                    <span class="form-control no-border">{{Stored.user.Username}}</span>
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">{{"Email"|T}}</label>
                <div class="col-sm-8">
                    <input type="email" parsley-trigger="change" required class="form-control" name="email" value="{{(Form "email")|Default Stored.user.Email}}">
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label"></label>
                <div class="col-sm-8">
                    <label>
                    <input type="checkbox" parsley-trigger="change" name="modifyPass" value="1"{{if Form "modifyPass"}} checked{{end}}>
                    {{"修改密码"|T}}</label>
                </div>
              </div>
              <div class="form-group new-password">
                <label class="col-sm-2 control-label">{{"新密码"|T}}</label>
                <div class="col-sm-8">
                    <input type="password" id="newPass" parsley-trigger="change" class="form-control" name="newPass" value="{{Form "newPass"}}">
                </div>
              </div>
              <div class="form-group new-password">
                <label class="col-sm-2 control-label">{{"确认新密码"|T}}</label>
                <div class="col-sm-8">
                    <input type="password" parsley-equalto="#newPass" parsley-trigger="change" class="form-control" name="confirmPass" value="{{Form "confirmPass"}}">
                </div>
              </div>
              <div class="form-group">
                <label class="col-sm-2 control-label">{{"密码验证"|T}}</label>
                <div class="col-sm-8">
                    <input type="password" parsley-trigger="change" required class="form-control" name="pass" value="{{Form "pass"}}" placeholder="{{"旧密码"|T}}">
                </div>
              </div>
              {{if Stored.needCheckU2F}}
              <div class="form-group">
                <label class="col-sm-2 control-label">{{"两步验证"|T}}</label>
                <div class="col-sm-8">
                    <input type="password" parsley-trigger="change" required class="form-control" name="u2fCode" value="{{Form "u2fCode"}}" placeholder="{{"输入两步验证设备上显示的密码"|T}}">
                    <div class="help-block">{{"输入两步验证设备上显示的密码"|T}}</div>
                </div>
              </div>
              {{end}}
              <div class="form-group">
									<div class="col-sm-9 col-sm-offset-2">
									  <button type="submit" class="btn btn-primary btn-lg"><i class="fa fa-save"></i> {{"保存"|T}}</button>
									  <button type="reset" class="btn btn-default btn-lg"><i class="fa fa-refresh"></i> {{"重置"|T}}</button>
									</div>
							</div>
            </form>
          </div><!-- /.content -->
        </div><!-- /.block-flat -->
    </div>
</div>
{{/Block}}
{{Block "footer"}}
<script type="text/javascript">
    $(function(){
        $('input[name="modifyPass"]').on('click',function(){
            if($(this).prop('checked')){
                $('.new-password').show();
            }else{
                $('.new-password').hide();
            }
        });
    });
    if($('input[name="modifyPass"]').prop('checked')){
        $('.new-password').show();
    }else{
        $('.new-password').hide();
    }
</script>
{{/Block}}